#include <stdarg.h>

#include <board_cfg.h>
#include <types.h>
#include <serial.h>
#include <vsprintf.h>

int getc(void)
{
	return serial_getc();
}

void putc(const char c)
{
	serial_putc(c);
}

int puts(const char *s)
{
	serial_puts(s);

	return 0;
}

int printf(const char *fmt, ...)
{
	va_list args;
	u_int32_t i;
	char printbuffer[CONFIG_PBSIZE];

	va_start(args, fmt);

	/* For this to work, printbuffer must be larger than
	 * anything we ever want to print.
	 */
	i = vsprintf(printbuffer, fmt, args);
	va_end(args);

	/* Print the string */
	puts(printbuffer);

	return 0;
}
